<!DOCTYPE html>
<html lang="pt-BR">
    <head>
        <?php
        session_start();
        include_once'bloco/head.php';
        include_once '../control/conexao.php';

        function __autoload($classe) {
            include_once"../model/{$classe}.class.php";
        }
        ?>
        <link href="bootstrap/css/morris.css" rel="stylesheet">
    </head>
    <body>      
        <div id="wrapper">
            <?php
            include_once'bloco/navbar.php';
            include_once'../control/valida_perfil.php';
            ?>
            <div id="page-wrapper">
                <?php include_once 'bloco/banner.php'; ?>                
                <div class="row">
                    <div class=" panel panel-success">
                        <div class="panel-heading">
                            <p class="panel-title"><i class = "glyphicon glyphicon-user"></i> Cadastrar Funcionario</p>
                        </div>
                        <div class="panel-body">
                            <div class="col-lg-12">
                                <form autocomplete="off" role="form" name="form_cadastra_funcionario" method="post" action="../control/cadastrar_funcionario.php">
                                    <input type="hidden" value="4" name="perfil">
                                    <div class="row">
                                        <div class="col-lg-6 col-md-offset-3">
                                            <div class="alert alert-success alert-dismissable">
                                                <table class="table">
                                                    <tr>
                                                        <td><strong>Senha</strong></td>                                                        
                                                        <td><input autocomplete="off" type="password" name="senha" class="form-control" required autofocus></td>
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Nome</strong></td>
                                                        <td><input type="text" name="nome" class="form-control" required autofocus></td>
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Login</strong></td>                                                        
                                                    <td><input autocomplete="off" type="text" name="login" class="form-control" required autofocus></td>
                                                    </tr>                                                    
                                                    <tr>
                                                        <td><strong>Perfil</strong></td>
                                                        <td>
                                                            <select class="btn btn-block" required name="perfil">
                                                                <option value="">Selecione...</option>
                                                                <?php
                                                                $consulta = mysql_query("SELECT * FROM perfil WHERE id_perfil = '0' || id_perfil='2'");
                                                                $ln = mysql_num_rows($consulta);
                                                                for ($i = 0; $i < $ln; $i++) {
                                                                    ?>
                                                                    <option value="<?php echo mysql_result($consulta, $i, "id_perfil") ?>"><?php echo mysql_result($consulta, $i, "perfil_nome") ?></option>
                                                                    <?php
                                                                }
                                                                ?>
                                                            </select>

                                                        </td>
                                                    </tr>                                                    
                                                </table>                                            
                                                <div align="center">
                                                    <button class="btn btn-success" type="submit">Cadastrar</button>
                                                </div>
                                            </div>                                            
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php
        include_once'bloco/scripts.php';
        ?>
        <script src="bootstrap/js/mascaras.js"></script>
    </body>
</html>
